package realQuestion.tuan;

import java.util.Scanner;

public class Test4 {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        String str = scanner.next();
        int[] dp = new int[n + 1];
        dp[0]=0;

        for (int i = 1; i <=n ; i++) {
            dp[i]=dp[i-1]+1;
            for (int j = i-2; j >=0 ; j--) {
                if (str.charAt(i-1)==str.charAt(j)){
                    dp[i]=Math.min(dp[i],dp[j]+1 );
                }

            }

        }
        System.out.println( dp[n]);


    }

}
